<template>
  <div class="typeLineNew">
    <div
      class="tyleLineNewBlock"
      @click="changeFactor(item.text, index)"
      v-for="(item, index) in arr"
      :key="index"
    >
      <img
        class="tlbImg"
        v-if="factorIndex != index"
        :src="require(`../../assets/yubaoIcon/${item.unactive}`)"
        alt=""
      />
      <img
        v-if="factorIndex == index"
        class="tlbImg"
        :src="require(`../../assets/yubaoIcon/${item.active}`)"
        alt=""
      />

      <span class="tlbText">{{ item.text }}</span>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      factorIndex: 0,
    };
  },
  props: {
    arr: Array,
  },
  components: {},

  computed: {},

  mounted() {},

  methods: {
    changeFactor(item, index) {
      this.factorIndex = index;
      this.$emit("changeFactor", item, index);
    },
  },
};
</script>
<style scoped></style>
